package com.xy.biz.xd.domain.converter;

import java.util.Collection;
import java.util.List;

import com.xy.tool.util.BeanUtilsEx;
import com.xy.biz.xd.domain.bo.DocumentFlowHandleUserBO;
import com.xy.biz.xd.domain.po.DocumentFlowHandleUserPO;
import com.xy.biz.xd.domain.query.DocumentFlowHandleUserQuery;
import com.xy.biz.xd.domain.resp.GetDocumentFlowHandleUserResponse;
import com.xy.biz.xd.domain.req.SaveDocumentFlowHandleUserRequest;
import com.xy.biz.xd.domain.req.ListDocumentFlowHandleUserRequest;

/**
 *
 *
 * @author zgy
 * @date 2022-5-24
 */
public class DocumentFlowHandleUserConverter {

	public static DocumentFlowHandleUserPO toPO(DocumentFlowHandleUserBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentFlowHandleUserPO(), true);
	}

	public static List<DocumentFlowHandleUserPO> toPO(Collection<DocumentFlowHandleUserBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentFlowHandleUserPO(), true);
	}

	public static DocumentFlowHandleUserBO fromPO(DocumentFlowHandleUserPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentFlowHandleUserBO());
	}

	public static List<DocumentFlowHandleUserBO> fromPO(Collection<DocumentFlowHandleUserPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentFlowHandleUserBO());
	}

	public static DocumentFlowHandleUserBO toBO(SaveDocumentFlowHandleUserRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new DocumentFlowHandleUserBO(), true);
	}

	public static List<DocumentFlowHandleUserBO> toBO(Collection<SaveDocumentFlowHandleUserRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new DocumentFlowHandleUserBO(), true);
	}

	public static GetDocumentFlowHandleUserResponse toResponse(DocumentFlowHandleUserBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetDocumentFlowHandleUserResponse());
	}

	public static List<GetDocumentFlowHandleUserResponse> toResponse(Collection<DocumentFlowHandleUserBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetDocumentFlowHandleUserResponse());
	}

	public static DocumentFlowHandleUserQuery toQuery(ListDocumentFlowHandleUserRequest source) {
		if(null == source) {
			return null;
		}
		DocumentFlowHandleUserQuery target = new DocumentFlowHandleUserQuery(source.getPageIndex(), source.getPageSize());
		BeanUtilsEx.copyProperties(source, target);
		return target;
	}

}
